/* eslint-disable*/
import Utils from "../index.js";
import adapter from "./adapter.js"
import getPluginType from "./getPluginType.js"

export default function setAttributes(dom, props) {
  const configJson = require("../../../pluginTemp/config.json")
  const pluginType = getPluginType()
  let {customConfig = {}, customOptions, type = ""} = adapter(props, pluginType)
  if (pluginType === "bigscreen" || pluginType === "analyzer") {
    customConfig = customOptions
  }
  const requirementNum = configJson["requirement-number"] ? `${configJson["requirement-number"]}-` : ""
  const domSymbol = customConfig?.id
    ? `${pluginType}-${type}-secondary-${requirementNum}${customConfig.id}`
    : `${pluginType}-${type}-secondary-${requirementNum}${Utils.generateUUID()}`
  const information = require('../../../scripts/information.json');
  const developers = information.developers || ""
  let className = dom.className
  className = className ? `${className} ${domSymbol}` : domSymbol
  dom.setAttribute("class", className)
  dom.setAttribute("developers", developers)
  if (process.env.NODE_ENV === "production" && type != "designConfiguration" && configJson["requirement-number"]) {
    console.info(`%c二开区域:`, "color:#5cde9c")
    console.info(dom)
  }
  return adapter(props, pluginType)
}
